// Utilities
import type { PoIType } from '@/typings'
import { defineStore } from 'pinia'

type StateType = {
  defaultMapName: string
  connect: null | boolean
  taskType: number
  selectedPoi: PoIType[]
  poiList: PoIType[]
}

export const useAppStore = defineStore('app', {
  state: () => ({
    defaultMapName: '',
    connect: null,
    taskType: -1,
    selectedPoi: [],
    poiList: [],
  } as StateType),
  actions: {
    setDefaultMapName (name: string) {
      this.defaultMapName = name
    },
    setConnect (connect: boolean) {
      this.connect = connect
    },
    setTaskType (type: number) {
      this.taskType = type
    },
    setSelectedPoi (poi: PoIType[]) {
      this.selectedPoi = poi
    },
    setPoiList (poi: PoIType[]) {
      this.poiList = poi
    },
  },
})
